package exam.xiecheng.spring.S4;

import java.util.*;

public class Main {

    public static int m;
    public static int n;
    public static int q;
    public static char[][] graph;
    public static int[][] row;
//    public static int[][] col;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        m = sc.nextInt();
        n = sc.nextInt();
        q = sc.nextInt();
        graph = new char[m][n];
        row = new int[m][n];
//        col = new int[m][n];
        sc.nextLine();
        for (int i=0; i<m; ++i)
            graph[i] = sc.nextLine().toCharArray();
        for (int i=0; i<q; ++i) {
            int x1 = sc.nextInt()-1;
            int y1 = sc.nextInt()-1;
            int x2 = sc.nextInt()-1;
            int y2 = sc.nextInt()-1;
            changeMatrix(x1, y1, x2, y2);
        }
        getMatrix();
        for (int i=0; i<m; ++i) {
            System.out.println(String.valueOf(graph[i]));
        }
    }

    public static void changeMatrix(int x1, int y1, int x2, int y2) {
        for (int i=x1; i<=x2; ++i) {
            row[i][y1]++;
            if (y2 < n-1)
                row[i][y2+1]--;
        }
    }

    public static void getMatrix() {
        for (int i=0; i<m; ++i) {
            for (int j=1; j<n; ++j) {
                row[i][j] += row[i][j-1];
            }
        }
        for (int i=0; i<m; ++i) {
            for (int j=0; j<n; ++j) {
                if(row[i][j] % 2 == 1) {
                    if (graph[i][j] >= 'a' && graph[i][j] <= 'z')
                        graph[i][j] = (char) (graph[i][j]-'a'+'A');
                    else
                        graph[i][j] = (char) (graph[i][j]-'A'+'a');
                }
            }
        }
    }
}